import HttpUtil from '@/common/HttpUtil'

const weatherApi = {
  findWeatherStationList (param) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/findAllStation'
    return HttpUtil.post(postUrl, param)
  },
  getWeatherInfo (id) {
    let getUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/getInfo/' + id
    return HttpUtil.get(getUrl, null)
  },
  addWeather (param) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/add'
    return HttpUtil.postJSON(postUrl, param)
  },
  updataWeather (param) {
    let putUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/update'
    return HttpUtil.putJSON(putUrl, param)
  },
  deleteWeather (id) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/delete/' + id
    return HttpUtil.delete(postUrl, null)
  },
  /**
   * 实时获取气象站详情
   * @param {*} params
   */
  getWeatherStationRealtimeData (param) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/findRealData'
    return HttpUtil.postJSON(postUrl, param)
  },
  /**
   * 获取气象站历史数据
   * @param {*} params
   */
  getWeatherStationHistoryData (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/findHistoryData'
    return HttpUtil.get(postUrl, params)
  },
  getWeatherStationList () {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/getList'
    return HttpUtil.get(postUrl, null)
  },
  findPageIndex (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/findPageIndex'
    return HttpUtil.postJSON(postUrl, params)
  },
  addIndex (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/addIndex'
    return HttpUtil.postJSON(postUrl, params)
  },
  updateIndex (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/updateIndex'
    return HttpUtil.putJSON(postUrl, params)
  },
  getIndexInfo (id) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/getIndexInfo/' + id
    return HttpUtil.get(postUrl, null)
  },
  deleteIndex (id) {
    let postUrl = process.env.SURVEY_DOMAIN + '/device/weather/station/deleteIndex/' + id
    return HttpUtil.delete(postUrl, null)
  }
}
export default weatherApi
